//
//  M4CloseTimerAlertView.swift
//  M4
//
//  Created by YuChuang on 2024/8/27.
//

import UIKit

class M4CloseTimerAlertView: UIView {
    
    @IBOutlet weak var M4CloseTimerTips: UILabel!
    
    var action1Block: (() -> Void)?
    var action2Block: (() -> Void)?

    override func awakeFromNib() {
        self.frame = CGRect(x: 0, y: 0, width: M4ScreenWidth, height: M4ScreenHeight)
        let rangeStr = "a tus ventajas"
        let labelStr = "¿Seguro que quieres renunciar a tus ventajas por tiempo limitado?"
        let attr = NSMutableAttributedString(string: labelStr)
        if let range = labelStr.range(of: rangeStr) {
            let nsRange = NSRange(range, in: labelStr)
            attr.addAttributes([.foregroundColor: COLOR_00479D], range: nsRange)
        }
        M4CloseTimerTips.attributedText = attr
    }
    
    @IBAction func M4CloseTimerAction1(_ sender: UIButton) {
        M4AlertViewHidden()
        action1Block?()
        sender.M4EventUnavailable = false
    }
    @IBAction func M4CloseTimerAction2(_ sender: UIButton) {
        M4AlertViewHidden()
        action2Block?()
        sender.M4EventUnavailable = false
    }
    
    

}
